<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test {
            padding: 20px;
        }

        video {
            width: 700px;
        }

        .shadow {
            box-shadow: 1px 1px 20px #000;
            padding: 20px 0;
            font-size: 30px;
            border: 1px solid red;
            border-radius: 10px;
            /* background-color: red; */
        }
    </style>
</head>

<body>
    <div class="test">
        <button>按钮</button>
        <h1 class="shadow">canvas绘制视频</h1>
        <video controls src="http://static.zangzhihong.com/565f044edb4b55697a2ff583d1b43a6f_2.mp4"></video>
    </div>

    <canvas id="canvas"></canvas>
</body>
<script src="../dist/main.js"></script>

<script>
    const root = document.querySelector(".test")

    layout(root, 'canvas')
    let timer;
    window.addEventListener('resize', () => {
        if (timer) { clearTimeout(timer) }
        timer = setTimeout(function () {
            layout(root, 'canvas')

        }, 100);
    })
</script>

</html>